#include <bits/stdc++.h>
using namespace std;

int GetMaxRound(int a,int b){

int dp[100][100];

for(int i = 0;i<100;i++){

for(int j = 0;j<100;j++){

if(i>=3) dp[i][j] = max(dp[i][j],dp[i-3][j] +1);

if(j>=3) dp[i][j] = max(dp[i][j],dp[i][j-3]+1);

if(i>=1&&j>=1) dp[i][j] = max(dp[i][j],dp[i-1][j-1] +1);

}

}

return dp[a][b]?dp[a][b]:-1;

}

int main(){
	cout<<GetMaxRound(3,3)<<endl;
	cout<<GetMaxRound(0,1)<<endl;
	
	return 0;
}
